"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: "me-fullscreen"
  },
  __name: "fullscrren",
  props: {
    to: {}
  },
  emits: ["toggle"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const getTargetElement = () => {
      const { to } = props;
      let target = null;
      if (to) {
        if (typeof to === "string") {
          target = document.getElementById(to);
        } else {
          target = to;
        }
      } else {
        target = document.documentElement;
      }
      return target;
    };
    const onClick = () => {
      const target = getTargetElement();
      if (!document.fullscreenElement) {
        target.requestFullscreen();
      } else if (document.exitFullscreen) {
        document.exitFullscreen();
      }
    };
    const onFullscreenChange = () => {
      emits("toggle", !!document.fullscreenElement);
    };
    vue.onMounted(() => {
      const target = getTargetElement();
      target.onfullscreenchange = onFullscreenChange;
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("span", {
        onClick,
        class: "me-fullscreen"
      }, [
        vue.renderSlot(_ctx.$slots, "default")
      ]);
    };
  }
});
exports.default = _sfc_main;
//# sourceMappingURL=fullscrren.vue2.cjs.map
